package cn.tedu.controller;

import cn.tedu.pojo.Student;
import cn.tedu.service.StudentService;
import cn.tedu.vo.PageResult;
import cn.tedu.vo.SysResult;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sun.org.apache.xerces.internal.util.SynchronizedSymbolTable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("/student")
public class StudentController {
    @Autowired
    private StudentService studentService;
    @GetMapping("/list")
    public SysResult getXuejiList(PageResult pageResult){
        pageResult = studentService.getXuejiList(pageResult);
        return SysResult.success(pageResult);
    }
    @GetMapping("/getStudentList")
    public SysResult getStudentList(PageResult pageResult){
        pageResult = studentService.getStudentList(pageResult);
        return SysResult.success(pageResult);
    }
    @PutMapping("/updateStudentById")
    public SysResult updateStudentById(@RequestBody Student student){
        studentService.updateStudentById(student);
        return SysResult.success();
    }
    @DeleteMapping("/deleteStudentById")
    public SysResult deleteStudentById(Integer id){
        studentService.deleteStudentById(id);
        return SysResult.success();
    }
}
